package cn.edu.sdjzu.xg.eagle.test;

import cn.edu.sdjzu.xg.eagle.entity.Pagination;
import cn.edu.sdjzu.xg.eagle.util.TxtHelper;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;

import java.io.IOException;

public class JsonTest1 {
    public static void main(String args[])throws IOException{
        String json_obj_str = TxtHelper.readTxt("files/"+"paginationObject.txt");
        JSONObject pagination_json_obj = JSON.parseObject(json_obj_str);

        Object pageSize_obj = pagination_json_obj.get("pageSize");
        Object pageNo_obj = pagination_json_obj.get("pageNo");

        Pagination pagination2 = JSON.parseObject(json_obj_str,Pagination.class);
        int pageNo2 = pagination2.getPageNo();
        int pageSize2 = pagination2.getPageSize();

        System.out.println(pageNo2);
        System.out.println(pageSize2);

    }
}
